def greetWithClosure(name, closure) {
    println("Hello, $name!")
    closure.call() // 调用传递进来的闭包
}


def sayGoodbye() {
    println("Goodbye!")
}

// 使用lambda表达式（匿名闭包）作为参数
greetWithClosure("Alice", closure = { sayGoodbye() })

// 使用已定义的闭包作为参数


def select(from, where = {}, save = {}) {
    def from_v = from.call()
    def where_v = where.call(from_v)
}

def select(String from, where = {}, save = {}) {
    return select({ from }, where, save)
}


def select(Map query) {
    return select(query.from, query.where, query.save)
}

Map query = [
        from : "1",
        where: { item -> println(item) }
]


def times2 = {
    a ->
        println("times2");
        a * 2
}
def add3 = {
    a ->
        println("add3");
        a + 3
}
def timesThenAdd = times2 >> add3

println(timesThenAdd(3))

def  crawel(String url){

}


